//
// Created by 28365 on 2025/3/14.
//

#ifndef ODUPDATERSDK_JSONUTILS_H
#define ODUPDATERSDK_JSONUTILS_H

#include <nlohmann/json.hpp>
#include "SerializeJson.h"

namespace JsonUtils{

    template<typename T>
    void formJson(nlohmann::json &j,T &value){
        if constexpr (std::is_base_of<SerializeJson, T>::value){
            (static_cast<SerializeJson*>(&value))->formJson(j,value);
        } else{
            j.get_to<T>(value);
        }
    }
}

#endif //ODUPDATERSDK_JSONUTILS_H
